//
//  ViewController.m
//  11. Timer Challenge
//
//  Created by iD Student on 7/8/13.
//  Copyright (c) 2013 iD Student. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    label.text = [NSString stringWithFormat:@"00:00:00"];
    hours = 0;
    minutes = 0;
    seconds = 0;
    timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(updateTimer) userInfo:nil repeats:YES];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void) updateTimer
{
    seconds += 1;
    if (seconds == 60)
    {
        minutes += 1;
        seconds = 0;
    }
    if (minutes == 60)
    {
        hours += 1;
        minutes = 0;
    }
    label.text = [NSString stringWithFormat:@"%d:%d:%d", hours, minutes, seconds];
    
    
}

@end
